#pragma once

#include <memory>
#include <mswin/thread.h>

class CXComp;

class Renderer : public mswin::thread
{
public:
	Renderer(CXComp & Comp);
	///the object deletes itself when the work is done
	virtual ~Renderer();
protected:
	virtual void report_error(const char * msg);
protected:
	CXComp & m_Comp;
};

typedef std::auto_ptr<Renderer> RendererAPtr;

/// Although renderers are acting in own threads, they have to be deleted from
/// the main thread due to synchronization reasons and Windows limitations
class AsyncDeleteRenderer
{
public:
	AsyncDeleteRenderer(Renderer * p) : m_pRenderer(p) { }
	~AsyncDeleteRenderer();
private:
	Renderer * m_pRenderer;
};